package gormUtils

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"strings"
)

func CreateMysqlCon(username, password, ipAddr, dbname string) *gorm.DB {
	baseConfig := []string{username, ":", password, "@tcp(", ipAddr, ")/", dbname}
	gormDb, err := gorm.Open(mysql.Open(strings.Join(baseConfig, "")), &gorm.Config{})
	if err != nil {
		panic(err)
	}
	return gormDb
}
